package it.cst.util;

import java.util.Comparator;

public class GroupStatComparator implements Comparator<GroupStat>
{
    public int compare(GroupStat gs1,GroupStat gs2)
    {
        if (gs1.getPercMatchWin() < gs2.getPercMatchWin())
            return 1;
        else if (gs1.getPercMatchWin() == gs2.getPercMatchWin())
        {
        	if(gs1.getPercMatchLoose() > gs2.getPercMatchLoose())
        		return 1;
        	else if(gs1.getPercMatchLoose() == gs2.getPercMatchLoose()){
        		if (gs1.getTotMatch() < gs2.getTotMatch())
                    return 1;
        		else if (gs1.getTotMatch() == gs2.getTotMatch())
        			return 0;
        		else
        			return -1;
        	}
        	else
        		return -1;
        } 
        else
            return -1;
    }
}
